<template>
  <div>
    <h1>用户信息{{ user }}</h1>
    <button @click="user.age += 1">点击年龄</button>
  </div>
</template>

<script setup>
import { watch, ref } from 'vue';

let user = ref({
  name: 'zs',
  age: 15,
});

watch(
  () => {
    return user.value.age;
  },
  () => {
    console.log('属性发生变化');
  }
);
</script>
